﻿using System.Web.UI;

namespace Eneta.Portal.NewsAndBlogs
{
    public static class Utility
    {
        public static Control FindControl(this Control control, string name, bool recursive)
        {
            if (!recursive)
                return control.FindControl(name);

            foreach (Control child in control.Controls)
            {
                if (child.ID == name)
                    return child;
                var ctl = child.FindControl(name, true);
                if (ctl != null)
                    return ctl;
            }
            return null;
        }
    }
}